package com.bdqn.controller;


import com.bdqn.dto.AppInfoListDto;
import com.bdqn.pojo.DevUser;
import com.bdqn.service.AppInfoService;
import com.bdqn.vo.AppInfoListVo;
import com.bdqn.vo.Page;
import com.bdqn.vo.ReturnVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/appInfo")
public class AppInfoController {

    @Autowired
    AppInfoService appInfoService;

    @ResponseBody
    @RequestMapping("/appInfoList")
    public ReturnVo appInfoList(@RequestBody AppInfoListDto appInfoListDto){
        Page page =appInfoService.getPage(appInfoListDto);
        Map<String,Object> map=new HashMap<>();
        map.put("page",page);
        return ReturnVo.success("查询成功", map);
    }


    @GetMapping("/view")
    public String appInfo(HttpSession session){
        DevUser devUser = (DevUser) session.getAttribute("DEV_USER");
        if (devUser != null){
            return "/appList";
        }else{
            return "/backend";
        }
    }
}
